const fs = require('fs')

exports.mkFile = () => {
  fs.mkdir('test', (err) => {
    if(err) {
      console.log(err.code);
      if(err.code === 'EEXIST') {
        console.log('此目录已存在');
        fs.writeFile('./test/index1.html', 'hello2 你好', 'utf8', (err) => {
          if(err) throw err
          console.log('writeFile 成功');
        })
        return
      }
      throw err
    }
    console.log('mkdir成功');
  })
}